< previous page page_31 next page >

Page 31
3. Change the form's width by using the mouse to click and drag the sizing handle in the center of the form's right edge (if you've changed your setup so that VB is running in SDI mode, you resize a form by simply dragging an edge or corner). Note that the value of the Width property in the Properties window has changed.
4. To change the Width property back to its original value, select the new value in the right side of the Properties window and replace it with its original value. When you press Enter, the form's width is changed.
Saving Your WorkAgain . . .
Now that you've completed designing the Loan Calculator's interface, this would be an excellent time to save your work so far. Because you already saved your nearly empty project just as you started it, resaving it is very easyand highly recommended. In fact, it makes sense to save your work at several stages of the interface development process. You never know when you'll have problems; a quick save only takes a few seconds, and could save you a lot of work when those problems do happen.
To resave your project, choose File, Save Project from the menu system, or simply click the Save Project button on the toolbar. Because you've already told Visual Basic where to save the files that make up your project, they're automatically saved in the same location, using the same filenames. If you have added new components (forms, modules, and so on) since the last save, you will be prompted for a filename and location for each of the newly added components.
Coding Your Program's Actions
As mentioned earlier, the user interface of the Loan Calculator program is now complete. However, it doesn't actually do anything at this point. In order for your program to become functional, you need to write some code. The term codeas it is used in this bookrefers to one or more lines of programming commands, written in a particular programming language (Visual Basic, in your case).
Responding to Events
Visual Basic is an object-oriented, event-driven language. This means that a program's interface is comprised of objects (controls, forms, and so forth); the program is "taught" what actions to perform when events happen to those objects.
An event is usually initiated by the user. By anticipating the possible events that can (and should) occur to the various objects in your program, you can write code to respond to those events appropriately. For example, in the case of a command button labeled Exit, your code should respond to that button's Click event by ending the program. This code should execute whenever the Exit button's Click event occurs.
You cause a program to respond to events by placing code in event procedures. An event procedure is a segment of code that is executed when a particular event occurs to a particular object.

 
< previous page page_31 next page >